import java.util.Scanner;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 04 - 16
 * Time: 22:14
 */
//求阶乘和
public class test3 {
    public static int factorial(int n) {
        if(n == 1) {
            return 1;
        }else {
            int factorial = n * factorial(n - 1);
            return factorial;
        }
    }
    public static int factorialAdd(int n) {
        if (n == 1) {
            return 1;
        } else {
            int sum = factorial(n) + factorialAdd(n - 1);
            return sum;
        }
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int sum = factorialAdd(n);
        System.out.println(sum);
    }
}
